package com.bowen.spike.service.impl;

import com.bowen.spike.entity.ProductType;
import com.bowen.spike.mapper.ProductTypeMapper;
import com.bowen.spike.service.IProductTypeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 商品类型表 服务实现类
 * </p>
 *
 * @author bowen
 * @since 2025-04-28
 */
@Service
public class ProductTypeServiceImpl extends ServiceImpl<ProductTypeMapper, ProductType> implements IProductTypeService {

    @Override
    public List<ProductType> getAllProductTypes() {
        return lambdaQuery()
                .list();

    }

    @Override
    public ProductType getProductTypeById(Long id) {
        return lambdaQuery()
                .eq(ProductType::getId, id)
                .one();
    }

    @Override
    public void createProductType(ProductType productType) {
        save(productType);
    }
}
